package tech.lixinlei.example;

import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import tech.lixinlei.example.external.config.bean.Tom;

@SpringBootApplication
public class ExampleApplication {

	public static void main(String[] args) {
		System.err.println(System.getProperties().getProperty("user.name"));
		ConfigurableApplicationContext context =
				new SpringApplicationBuilder(ExampleApplication.class)
						.web(WebApplicationType.NONE)
						.run(args);

//		User user = context.getBean("user", User.class);
//		System.err.println(user.getDesc());

		Tom tom = context.getBean("tom", Tom.class);
		System.out.println(tom.getColor()); // red

		context.close();
	}

}
